<?php /*a:1:{s:60:"/www/wwwroot/marry.idhx.top/view/admin/system/edit_menu.html";i:1685693540;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layuimini/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuimini/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/layuimini/css/public.css" media="all">
</head>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <!-- layui-form-pane 方框式表单 -->
            <form class="layui-form layui-form-pane" action="" lay-filter="example">
                <div class="layui-form-item">
                    <label class="layui-form-label">上级权限</label>
                    <div class="layui-input-block">
                        <select name="pid" lay-verify="required" lay-search="">
                            <option value="0" <?php if($one['pid']==0): ?> selected <?php endif; ?>>顶级菜单</option>
                            <?php if(is_array($menuList) || $menuList instanceof \think\Collection || $menuList instanceof \think\Paginator): $i = 0; $__LIST__ = $menuList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <option value="<?php echo htmlentities($vo['id']); ?>" <?php if($one['pid']==$vo['id']): ?> selected <?php endif; if($one['id']==$vo['id']): ?> disabled="" <?php endif; ?> ><?php echo htmlentities($vo['title']); ?></option>
                                <?php if($vo['child']): if(is_array($vo['child']) || $vo['child'] instanceof \think\Collection || $vo['child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo2): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo htmlentities($vo2['id']); ?>" <?php if($one['pid']==$vo2['id']): ?> selected <?php endif; if($one['id']==$vo2['id']): ?> disabled="" <?php endif; ?>>----<?php echo htmlentities($vo2['title']); ?></option>
                                        <?php if($vo2['child']): if(is_array($vo2['child']) || $vo2['child'] instanceof \think\Collection || $vo2['child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo2['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo3): $mod = ($i % 2 );++$i;?>
                                        <option value="<?php echo htmlentities($vo3['id']); ?>" <?php if($one['pid']==$vo3['id']): ?> selected <?php endif; if($one['id']==$vo3['id']): ?> disabled="" <?php endif; ?>>--------<?php echo htmlentities($vo3['title']); ?></option>
                                        <?php endforeach; endif; else: echo "" ;endif; ?>
                                        <?php endif; ?>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                <?php endif; ?>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">权限名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入名称"
                            class="layui-input" value="<?php echo htmlentities($one['title']); ?>">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">路由地址</label>
                    <div class="layui-input-block">
                        <input type="text" name="href" autocomplete="off" placeholder="请输入路由" class="layui-input" value="<?php echo htmlentities($one['href']); ?>">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-block">
                        <input type="number" name="sort" autocomplete="off" class="layui-input" value="<?php echo htmlentities($one['sort']); ?>">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">选择图标</label>
                    <div class="layui-input-block">
                        <input type="text" name="icon" id="iconPicker" lay-filter="iconPicker" class="hide" value="<?php echo htmlentities($one['icon']); ?>">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <input type="checkbox" <?php if($one['status']==1): ?> checked=""<?php endif; ?> name="status" lay-skin="switch" lay-filter="switchTest"
                            lay-text="正常|关闭">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">类型</label>
                    <div class="layui-input-block">
                        <input type="radio" name="type" value="1" title="菜单" <?php if($one['type']==1): ?> checked=""<?php endif; ?> >
                        <input type="radio" name="type" value="2" title="权限" <?php if($one['type']==2): ?> checked=""<?php endif; ?> >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">打开方式</label>
                    <div class="layui-input-block">
                        <input type="radio" name="target" value="_self" title="当前" <?php if($one['target']=='_self'): ?> checked=""<?php endif; ?> >
                        <input type="radio" name="target" value="_blank" title="新窗口" <?php if($one['target']=='_blank'): ?> checked=""<?php endif; ?>>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入内容" class="layui-textarea" name="desc"><?php echo htmlentities($one['desc']); ?></textarea>
                    </div>
                </div>
                <input type="hidden" value="<?php echo htmlentities($one['id']); ?>" name="id">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                        <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
                    </div>
                </div>
            </form>
        </div>
    </div>

    <script src="/layuimini/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script src="/layuimini/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
    <script>
        layui.use(['form', 'iconPickerFa'], function () {
            var form = layui.form,
                iconPickerFa = layui.iconPickerFa,
                $ = layui.$,
                layer = layui.layer;

            iconPickerFa.render({
                // 选择器，推荐使用input
                elem: '#iconPicker',
                // fa 图标接口
                url: "/layuimini/lib/font-awesome-4.7.0/less/variables.less",
                // 是否开启搜索：true/false，默认true
                search: true,
                // 是否开启分页：true/false，默认true
                page: true,
                // 每页显示数量，默认12
                limit: 16,
                // 点击回调
                click: function (data) {
                    console.log(data);
                },
                // 渲染成功后的回调
                success: function (d) {
                    console.log(d);
                }
            });
            //监听指定开关
            form.on('switch(switchTest)', function (data) {

            });

            //监听提交
            form.on('submit(demo1)', function (data) {
                $.ajax({
                    type: "post",
                    url: "saveMenu",
                    data: data.field,
                    dataType: "json",
                    success: function (res) {
                        if (res.code == 1) {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            // parent.layer.close(index); //再执行关闭 
                            // 关闭后调用
                            layer.msg(res.msg)
                            setTimeout(function () {
                                parent.layer.close(index);

                            }, 500)
                        } else {
                            layer.msg(res.msg)
                        }


                    }
                });
                return false;
            });
        });
    </script>

</body>

</html>